import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'path'
import { JSONFilePreset } from 'lowdb/node'

const __dirname = dirname(fileURLToPath(import.meta.url))

// const db = await JSONFilePreset("./db/db.json", defaultData);

// db.data.posts.push("hello world");
// await db.write();

export const projectConfig = await JSONFilePreset(resolve(__dirname, 'project-config.json'), {
  nvd: {
    currentPage: 1,
    maxPage: 9471,
    url: 'https://avd.aliyun.com/nvd/list',
  },
  nonvd: {
    currentPage: 1,
    maxPage: 2954,
    url: 'https://avd.aliyun.com/nonvd/list',
  },
  debug: false,
})

export default {
  projectConfig,
}
